# -*- coding: utf-8 -*- 
#
# Description:
#
#  Definiton
#
#
#
# Changes:
#
# 2012-01-10
# Initial Commit
#
#
# Copyright 2010-2012, WyDev Team.
# Author: Polo35 (polo35580@hotmail.fr)
#
# Licenced under Academic Free License version 3.0
# Review WyGui README & LICENSE files for further details.

nname: 0
n 0(None)[from ConfigParser import ConfigParser
import os
wyscan_conf = ConfigParser()
wyscan_conf.read(config.wyscan_config_file)
wyscan_db = wyscan_conf.get('global', 'databasefile')
log.debug('remove ' + wyscan_conf.get('global', 'databasefile'))
os.remove(wyscan_db)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb764dd2c>}
nname: 0
n 0(None)[import os
log.debug('remove ' + config.recordings_list_file)
os.remove(config.recordings_list_file)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb764dacc>}
nname: 581
n 581(None)[self.ext_standby.RemoveStandbyModule(config.wystandby_id)
config.wystandby_id = self.ext_standby.AddStandbyModule(config.wystandby_id)
self.ext_standby.SetMaxPowerState(config.wystandby_id, APM_STATE_OFF)
removeFolder(config.timeshift_base_folder_path)
self.scheduler.AsynchronousCheckSchedule(config.scheduler_start_delay)
AsynchronousAction().resume()
AsynchronousAction().start()
]:
	i: 518(), 580()
	o: 

nname: 580
n 580(None)[]:
	i: 199(f)
	o: 581()

nname: 518
n 518(None)[self.disk_space_checker = DiskSpaceChecker(self)
self.timer_disk_space = timers.ThreadedTimer(self.disk_space_checker.checkDiskUsage)
self.timer_disk_space.start(config.disk_usage_check_period)
]:
	i: 199(t)
	o: 581()

nname: 199
n 199(config.disk_space_manager_active)[nb_device = len(self.external_dvb_manager.GetDevices(nDeviceType=1))
self.configureDeviceNumber(nb_device)
self.callbacks = Callbacks(self.external_dvb_manager.wyscan)
self.external_recorder_factory = ExternalRecorderFactory(self.wydb)
self.renderer_manager = RendererManager(self.wyplayer)
self.live_manager = LiveManager(self.external_dvb_manager, self.external_recorder_factory, self.ext_disk_space)
self.ext_disk_space.live_manager = self.live_manager
self.recording_builder = RecordingBuilder(self.live_manager, self.external_dvb_manager, self.renderer_manager)
self.scheduler = RecordScheduler(self.recording_builder, self.external_dvb_manager, self.dbus_signaler, self.ext_disk_space, self.ext_standby)
self.live_controller = LiveController(self.wyplayer, self.live_manager, self.scheduler, self.renderer_manager)
self.newExternEpgAvailableCallback = self.external_dvb_manager.wyscan.newExternEpgAvailableCallback
self.dbus_listener = DbusListener(self.wydb, self.scheduler, self.ext_standby, self.live_manager, self.wyscan)
]:
	i: 158(), 180()
	o: 518(t), 580(f)

nname: 180
n 180(None)[self.external_dvb_manager = ExternalDVBManager(self.wyscan)
]:
	i: 0(f)
	o: 199()

nname: 158
n 158(None)[self.external_dvb_manager = ExternalDVBManagerInterface(self.wyscan)
]:
	i: 0(t)
	o: 199()

nname: 0
n 0(config.dummy_wyscan)[log.info('WyRecord ..........................')
AsynchronousAction().pause()
self.wyrecord_global_lock = wyrecord_global_lock
self.wyscan = WyScan.WYScanServer(config.wyscan_dbus_bus_name, config.wyscan_dbus_path_name, 'com.wyrecord.recordinglauncher')
self.wydb = self.wyscan.wdb
self.ext_standby = ExternalStandby(self.wydb)
self.ext_disk_space = ExternalDiskSpace(self.wydb, config.disk_device)
self.dbus_signaler = DbusSignaler(self.wydb)
self.wyplayer = wyplayer
]:
	i: 
	o: 158(t), 180(f)

nname: 581
n 581(None)[self.ext_standby.RemoveStandbyModule(config.wystandby_id)
config.wystandby_id = self.ext_standby.AddStandbyModule(config.wystandby_id)
self.ext_standby.SetMaxPowerState(config.wystandby_id, APM_STATE_OFF)
removeFolder(config.timeshift_base_folder_path)
self.scheduler.AsynchronousCheckSchedule(config.scheduler_start_delay)
AsynchronousAction().resume()
AsynchronousAction().start()
]:
	i: 0()
	o: 

nname: 0
n 0(None)[log.info('WyRecord ..........................')
AsynchronousAction().pause()
self.wyrecord_global_lock = wyrecord_global_lock
self.wyscan = WyScan.WYScanServer(config.wyscan_dbus_bus_name, config.wyscan_dbus_path_name, 'com.wyrecord.recordinglauncher')
self.wydb = self.wyscan.wdb
self.ext_standby = ExternalStandby(self.wydb)
self.ext_disk_space = ExternalDiskSpace(self.wydb, config.disk_device)
self.dbus_signaler = DbusSignaler(self.wydb)
self.wyplayer = wyplayer
if config.dummy_wyscan:
	self.external_dvb_manager = ExternalDVBManagerInterface(self.wyscan)
else:
	self.external_dvb_manager = ExternalDVBManager(self.wyscan)
nb_device = len(self.external_dvb_manager.GetDevices(nDeviceType=1))
self.configureDeviceNumber(nb_device)
self.callbacks = Callbacks(self.external_dvb_manager.wyscan)
self.external_recorder_factory = ExternalRecorderFactory(self.wydb)
self.renderer_manager = RendererManager(self.wyplayer)
self.live_manager = LiveManager(self.external_dvb_manager, self.external_recorder_factory, self.ext_disk_space)
self.ext_disk_space.live_manager = self.live_manager
self.recording_builder = RecordingBuilder(self.live_manager, self.external_dvb_manager, self.renderer_manager)
self.scheduler = RecordScheduler(self.recording_builder, self.external_dvb_manager, self.dbus_signaler, self.ext_disk_space, self.ext_standby)
self.live_controller = LiveController(self.wyplayer, self.live_manager, self.scheduler, self.renderer_manager)
self.newExternEpgAvailableCallback = self.external_dvb_manager.wyscan.newExternEpgAvailableCallback
self.dbus_listener = DbusListener(self.wydb, self.scheduler, self.ext_standby, self.live_manager, self.wyscan)
if config.disk_space_manager_active:
	self.disk_space_checker = DiskSpaceChecker(self)
	self.timer_disk_space = timers.ThreadedTimer(self.disk_space_checker.checkDiskUsage)
	self.timer_disk_space.start(config.disk_usage_check_period)
]:
	i: 
	o: 581()

nname: 0
n 0(None)[log.info('WyRecord ..........................')
AsynchronousAction().pause()
self.wyrecord_global_lock = wyrecord_global_lock
self.wyscan = WyScan.WYScanServer(config.wyscan_dbus_bus_name, config.wyscan_dbus_path_name, 'com.wyrecord.recordinglauncher')
self.wydb = self.wyscan.wdb
self.ext_standby = ExternalStandby(self.wydb)
self.ext_disk_space = ExternalDiskSpace(self.wydb, config.disk_device)
self.dbus_signaler = DbusSignaler(self.wydb)
self.wyplayer = wyplayer
if config.dummy_wyscan:
	self.external_dvb_manager = ExternalDVBManagerInterface(self.wyscan)
else:
	self.external_dvb_manager = ExternalDVBManager(self.wyscan)
nb_device = len(self.external_dvb_manager.GetDevices(nDeviceType=1))
self.configureDeviceNumber(nb_device)
self.callbacks = Callbacks(self.external_dvb_manager.wyscan)
self.external_recorder_factory = ExternalRecorderFactory(self.wydb)
self.renderer_manager = RendererManager(self.wyplayer)
self.live_manager = LiveManager(self.external_dvb_manager, self.external_recorder_factory, self.ext_disk_space)
self.ext_disk_space.live_manager = self.live_manager
self.recording_builder = RecordingBuilder(self.live_manager, self.external_dvb_manager, self.renderer_manager)
self.scheduler = RecordScheduler(self.recording_builder, self.external_dvb_manager, self.dbus_signaler, self.ext_disk_space, self.ext_standby)
self.live_controller = LiveController(self.wyplayer, self.live_manager, self.scheduler, self.renderer_manager)
self.newExternEpgAvailableCallback = self.external_dvb_manager.wyscan.newExternEpgAvailableCallback
self.dbus_listener = DbusListener(self.wydb, self.scheduler, self.ext_standby, self.live_manager, self.wyscan)
if config.disk_space_manager_active:
	self.disk_space_checker = DiskSpaceChecker(self)
	self.timer_disk_space = timers.ThreadedTimer(self.disk_space_checker.checkDiskUsage)
	self.timer_disk_space.start(config.disk_usage_check_period)
self.ext_standby.RemoveStandbyModule(config.wystandby_id)
config.wystandby_id = self.ext_standby.AddStandbyModule(config.wystandby_id)
self.ext_standby.SetMaxPowerState(config.wystandby_id, APM_STATE_OFF)
removeFolder(config.timeshift_base_folder_path)
self.scheduler.AsynchronousCheckSchedule(config.scheduler_start_delay)
AsynchronousAction().resume()
AsynchronousAction().start()
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75ec70c>}
nname: 0
n 0(None)[AsynchronousAction().exit()
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb764630c>}
nname: 24
n 24(None)[return self.live_controller
]:
	i: 6(), 23()
	o: 

nname: 23
n 23(None)[]:
	i: 0(f)
	o: 24()

nname: 6
n 6(None)[self.setRenderer(wyplayer)
]:
	i: 0(t)
	o: 24()

nname: 0
n 0(wyplayer)[]:
	i: 
	o: 6(t), 23(f)

nname: 0
n 0(None)[if wyplayer:
	self.setRenderer(wyplayer)
return self.live_controller
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb764626c>}
nname: 0
n 0(None)[config.max_size_for_timeshift = duration * config.bytes_per_sec
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb764632c>}
nname: 0
n 0(None)[config.record_start_padding = duration
config.record_stop_padding = duration
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb764664c>}
nname: 0
n 0(None)[self.wyplayer = wyplayer
self.external_recorder_factory.wyplayer = wyplayer
self.renderer_manager.default_renderer.wyplayer = wyplayer
self.live_controller.wyplayer = wyplayer
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb764674c>}
nname: 81
n 81(None)[]:
	i: 45(), 80()
	o: 

nname: 80
n 80(None)[]:
	i: 0&32(f)
	o: 81()

nname: 45
n 45(None)[config.nb_virtual_tuner = nb_device
config.live_count_max = nb_device
config.max_simultaneous_rec = nb_device - 1
]:
	i: 0&32(t)
	o: 81()

nname: 0&32
n 0&32(config.autoconf_tuner and nb_device > 1)[log.info('DVB-T devices number = ' + str(nb_device))
]:
	i: 
	o: 45(t), 80(f)

nname: 0&32
n 0&32(None)[log.info('DVB-T devices number = ' + str(nb_device))
if config.autoconf_tuner and nb_device > 1:
	config.nb_virtual_tuner = nb_device
	config.live_count_max = nb_device
	config.max_simultaneous_rec = nb_device - 1
]:
	i: 
	o: 

self.nodes: {'0&32': <unpyclib.structure.node instance at 0xb764656c>}
nname: 6
n 6(None)[__metaclass__ = MetaSingleton
def __init__(self, wyplayer=None):
	log.info('WyRecord ..........................')
	AsynchronousAction().pause()
	self.wyrecord_global_lock = wyrecord_global_lock
	self.wyscan = WyScan.WYScanServer(config.wyscan_dbus_bus_name, config.wyscan_dbus_path_name, 'com.wyrecord.recordinglauncher')
	self.wydb = self.wyscan.wdb
	self.ext_standby = ExternalStandby(self.wydb)
	self.ext_disk_space = ExternalDiskSpace(self.wydb, config.disk_device)
	self.dbus_signaler = DbusSignaler(self.wydb)
	self.wyplayer = wyplayer
	if config.dummy_wyscan:
		self.external_dvb_manager = ExternalDVBManagerInterface(self.wyscan)
	else:
		self.external_dvb_manager = ExternalDVBManager(self.wyscan)
	nb_device = len(self.external_dvb_manager.GetDevices(nDeviceType=1))
	self.configureDeviceNumber(nb_device)
	self.callbacks = Callbacks(self.external_dvb_manager.wyscan)
	self.external_recorder_factory = ExternalRecorderFactory(self.wydb)
	self.renderer_manager = RendererManager(self.wyplayer)
	self.live_manager = LiveManager(self.external_dvb_manager, self.external_recorder_factory, self.ext_disk_space)
	self.ext_disk_space.live_manager = self.live_manager
	self.recording_builder = RecordingBuilder(self.live_manager, self.external_dvb_manager, self.renderer_manager)
	self.scheduler = RecordScheduler(self.recording_builder, self.external_dvb_manager, self.dbus_signaler, self.ext_disk_space, self.ext_standby)
	self.live_controller = LiveController(self.wyplayer, self.live_manager, self.scheduler, self.renderer_manager)
	self.newExternEpgAvailableCallback = self.external_dvb_manager.wyscan.newExternEpgAvailableCallback
	self.dbus_listener = DbusListener(self.wydb, self.scheduler, self.ext_standby, self.live_manager, self.wyscan)
	if config.disk_space_manager_active:
		self.disk_space_checker = DiskSpaceChecker(self)
		self.timer_disk_space = timers.ThreadedTimer(self.disk_space_checker.checkDiskUsage)
		self.timer_disk_space.start(config.disk_usage_check_period)
	self.ext_standby.RemoveStandbyModule(config.wystandby_id)
	config.wystandby_id = self.ext_standby.AddStandbyModule(config.wystandby_id)
	self.ext_standby.SetMaxPowerState(config.wystandby_id, APM_STATE_OFF)
	removeFolder(config.timeshift_base_folder_path)
	self.scheduler.AsynchronousCheckSchedule(config.scheduler_start_delay)
	AsynchronousAction().resume()
	AsynchronousAction().start()

def __del__(self):
	AsynchronousAction().exit()

def getLiveController(self, wyplayer=None):
	if wyplayer:
		self.setRenderer(wyplayer)
	return self.live_controller

def setMaximumTimeshiftDuration(self, duration):
	config.max_size_for_timeshift = duration * config.bytes_per_sec

def setRecordPadding(self, duration):
	config.record_start_padding = duration
	config.record_stop_padding = duration

def setRenderer(self, wyplayer):
	self.wyplayer = wyplayer
	self.external_recorder_factory.wyplayer = wyplayer
	self.renderer_manager.default_renderer.wyplayer = wyplayer
	self.live_controller.wyplayer = wyplayer

def configureDeviceNumber(self, nb_device):
	log.info('DVB-T devices number = ' + str(nb_device))
	if config.autoconf_tuner and nb_device > 1:
		config.nb_virtual_tuner = nb_device
		config.live_count_max = nb_device
		config.max_simultaneous_rec = nb_device - 1

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb764dc2c>}
nname: 0
n 0(None)[__doc__ = '\nuse to initialyse full wyrecord feature.\n'
import sys
import error
import WyScan
from recordscheduler import RecordScheduler
from livemanager import LiveManager
from livecontroller import LiveController
from recording import RecordingBuilder
from config import *
from diskspaceuse import DiskSpaceChecker
from externaldvbmanager import ExternalDVBManager
from externaldvbmanager import ExternalDVBManagerInterface
from externalrecorderfactory import ExternalRecorderFactory
from renderermanager import RendererManager
from peewee import timers
from logger import log
from dbusapi import DbusSignaler
from dbusapi import DbusListener
from wydbus import WyDbus
from externalstandby import ExternalStandby
from externaldiskspace import ExternalDiskSpace
from tools import removeFolder
from peewee.misc_utils import MetaSingleton
from callbacks import Callbacks
from asynchronousaction import ActionRemoveFolder
from asynchronousaction import AsynchronousAction
from globallock import wyrecord_global_lock
def wyscanFactoryDefault():
	from ConfigParser import ConfigParser
	import os
	wyscan_conf = ConfigParser()
	wyscan_conf.read(config.wyscan_config_file)
	wyscan_db = wyscan_conf.get('global', 'databasefile')
	log.debug('remove ' + wyscan_conf.get('global', 'databasefile'))
	os.remove(wyscan_db)

def wyrecordFactoryDefault():
	import os
	log.debug('remove ' + config.recordings_list_file)
	os.remove(config.recordings_list_file)

class WyRecord(object):
	__metaclass__ = MetaSingleton
	def __init__(self, wyplayer=None):
		log.info('WyRecord ..........................')
		AsynchronousAction().pause()
		self.wyrecord_global_lock = wyrecord_global_lock
		self.wyscan = WyScan.WYScanServer(config.wyscan_dbus_bus_name, config.wyscan_dbus_path_name, 'com.wyrecord.recordinglauncher')
		self.wydb = self.wyscan.wdb
		self.ext_standby = ExternalStandby(self.wydb)
		self.ext_disk_space = ExternalDiskSpace(self.wydb, config.disk_device)
		self.dbus_signaler = DbusSignaler(self.wydb)
		self.wyplayer = wyplayer
		if config.dummy_wyscan:
			self.external_dvb_manager = ExternalDVBManagerInterface(self.wyscan)
		else:
			self.external_dvb_manager = ExternalDVBManager(self.wyscan)
		nb_device = len(self.external_dvb_manager.GetDevices(nDeviceType=1))
		self.configureDeviceNumber(nb_device)
		self.callbacks = Callbacks(self.external_dvb_manager.wyscan)
		self.external_recorder_factory = ExternalRecorderFactory(self.wydb)
		self.renderer_manager = RendererManager(self.wyplayer)
		self.live_manager = LiveManager(self.external_dvb_manager, self.external_recorder_factory, self.ext_disk_space)
		self.ext_disk_space.live_manager = self.live_manager
		self.recording_builder = RecordingBuilder(self.live_manager, self.external_dvb_manager, self.renderer_manager)
		self.scheduler = RecordScheduler(self.recording_builder, self.external_dvb_manager, self.dbus_signaler, self.ext_disk_space, self.ext_standby)
		self.live_controller = LiveController(self.wyplayer, self.live_manager, self.scheduler, self.renderer_manager)
		self.newExternEpgAvailableCallback = self.external_dvb_manager.wyscan.newExternEpgAvailableCallback
		self.dbus_listener = DbusListener(self.wydb, self.scheduler, self.ext_standby, self.live_manager, self.wyscan)
		if config.disk_space_manager_active:
			self.disk_space_checker = DiskSpaceChecker(self)
			self.timer_disk_space = timers.ThreadedTimer(self.disk_space_checker.checkDiskUsage)
			self.timer_disk_space.start(config.disk_usage_check_period)
		self.ext_standby.RemoveStandbyModule(config.wystandby_id)
		config.wystandby_id = self.ext_standby.AddStandbyModule(config.wystandby_id)
		self.ext_standby.SetMaxPowerState(config.wystandby_id, APM_STATE_OFF)
		removeFolder(config.timeshift_base_folder_path)
		self.scheduler.AsynchronousCheckSchedule(config.scheduler_start_delay)
		AsynchronousAction().resume()
		AsynchronousAction().start()

	def __del__(self):
		AsynchronousAction().exit()

	def getLiveController(self, wyplayer=None):
		if wyplayer:
			self.setRenderer(wyplayer)
		return self.live_controller

	def setMaximumTimeshiftDuration(self, duration):
		config.max_size_for_timeshift = duration * config.bytes_per_sec

	def setRecordPadding(self, duration):
		config.record_start_padding = duration
		config.record_stop_padding = duration

	def setRenderer(self, wyplayer):
		self.wyplayer = wyplayer
		self.external_recorder_factory.wyplayer = wyplayer
		self.renderer_manager.default_renderer.wyplayer = wyplayer
		self.live_controller.wyplayer = wyplayer

	def configureDeviceNumber(self, nb_device):
		log.info('DVB-T devices number = ' + str(nb_device))
		if config.autoconf_tuner and nb_device > 1:
			config.nb_virtual_tuner = nb_device
			config.live_count_max = nb_device
			config.max_simultaneous_rec = nb_device - 1



]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb7639d4c>}
__doc__ = '\nuse to initialyse full wyrecord feature.\n'
import sys
import error
import WyScan
from recordscheduler import RecordScheduler
from livemanager import LiveManager
from livecontroller import LiveController
from recording import RecordingBuilder
from config import *
from diskspaceuse import DiskSpaceChecker
from externaldvbmanager import ExternalDVBManager
from externaldvbmanager import ExternalDVBManagerInterface
from externalrecorderfactory import ExternalRecorderFactory
from renderermanager import RendererManager
from peewee import timers
from logger import log
from dbusapi import DbusSignaler
from dbusapi import DbusListener
from wydbus import WyDbus
from externalstandby import ExternalStandby
from externaldiskspace import ExternalDiskSpace
from tools import removeFolder
from peewee.misc_utils import MetaSingleton
from callbacks import Callbacks
from asynchronousaction import ActionRemoveFolder
from asynchronousaction import AsynchronousAction
from globallock import wyrecord_global_lock
def wyscanFactoryDefault():
	from ConfigParser import ConfigParser
	import os
	wyscan_conf = ConfigParser()
	wyscan_conf.read(config.wyscan_config_file)
	wyscan_db = wyscan_conf.get('global', 'databasefile')
	log.debug('remove ' + wyscan_conf.get('global', 'databasefile'))
	os.remove(wyscan_db)

def wyrecordFactoryDefault():
	import os
	log.debug('remove ' + config.recordings_list_file)
	os.remove(config.recordings_list_file)

class WyRecord(object):
	__metaclass__ = MetaSingleton
	def __init__(self, wyplayer=None):
		log.info('WyRecord ..........................')
		AsynchronousAction().pause()
		self.wyrecord_global_lock = wyrecord_global_lock
		self.wyscan = WyScan.WYScanServer(config.wyscan_dbus_bus_name, config.wyscan_dbus_path_name, 'com.wyrecord.recordinglauncher')
		self.wydb = self.wyscan.wdb
		self.ext_standby = ExternalStandby(self.wydb)
		self.ext_disk_space = ExternalDiskSpace(self.wydb, config.disk_device)
		self.dbus_signaler = DbusSignaler(self.wydb)
		self.wyplayer = wyplayer
		if config.dummy_wyscan:
			self.external_dvb_manager = ExternalDVBManagerInterface(self.wyscan)
		else:
			self.external_dvb_manager = ExternalDVBManager(self.wyscan)
		nb_device = len(self.external_dvb_manager.GetDevices(nDeviceType=1))
		self.configureDeviceNumber(nb_device)
		self.callbacks = Callbacks(self.external_dvb_manager.wyscan)
		self.external_recorder_factory = ExternalRecorderFactory(self.wydb)
		self.renderer_manager = RendererManager(self.wyplayer)
		self.live_manager = LiveManager(self.external_dvb_manager, self.external_recorder_factory, self.ext_disk_space)
		self.ext_disk_space.live_manager = self.live_manager
		self.recording_builder = RecordingBuilder(self.live_manager, self.external_dvb_manager, self.renderer_manager)
		self.scheduler = RecordScheduler(self.recording_builder, self.external_dvb_manager, self.dbus_signaler, self.ext_disk_space, self.ext_standby)
		self.live_controller = LiveController(self.wyplayer, self.live_manager, self.scheduler, self.renderer_manager)
		self.newExternEpgAvailableCallback = self.external_dvb_manager.wyscan.newExternEpgAvailableCallback
		self.dbus_listener = DbusListener(self.wydb, self.scheduler, self.ext_standby, self.live_manager, self.wyscan)
		if config.disk_space_manager_active:
			self.disk_space_checker = DiskSpaceChecker(self)
			self.timer_disk_space = timers.ThreadedTimer(self.disk_space_checker.checkDiskUsage)
			self.timer_disk_space.start(config.disk_usage_check_period)
		self.ext_standby.RemoveStandbyModule(config.wystandby_id)
		config.wystandby_id = self.ext_standby.AddStandbyModule(config.wystandby_id)
		self.ext_standby.SetMaxPowerState(config.wystandby_id, APM_STATE_OFF)
		removeFolder(config.timeshift_base_folder_path)
		self.scheduler.AsynchronousCheckSchedule(config.scheduler_start_delay)
		AsynchronousAction().resume()
		AsynchronousAction().start()

	def __del__(self):
		AsynchronousAction().exit()

	def getLiveController(self, wyplayer=None):
		if wyplayer:
			self.setRenderer(wyplayer)
		return self.live_controller

	def setMaximumTimeshiftDuration(self, duration):
		config.max_size_for_timeshift = duration * config.bytes_per_sec

	def setRecordPadding(self, duration):
		config.record_start_padding = duration
		config.record_stop_padding = duration

	def setRenderer(self, wyplayer):
		self.wyplayer = wyplayer
		self.external_recorder_factory.wyplayer = wyplayer
		self.renderer_manager.default_renderer.wyplayer = wyplayer
		self.live_controller.wyplayer = wyplayer

	def configureDeviceNumber(self, nb_device):
		log.info('DVB-T devices number = ' + str(nb_device))
		if config.autoconf_tuner and nb_device > 1:
			config.nb_virtual_tuner = nb_device
			config.live_count_max = nb_device
			config.max_simultaneous_rec = nb_device - 1



